<%= form_for(@question_type) do |f| %>
  <% if @question_type.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@question_type.errors.count, "error") %> prohibited this question_type from being saved:</h2>

      <ul>
      <% @question_type.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="actions">
    <p>Name: <%= f.text_field :name %></p>

    <table>
      <tr><td>-</td></tr>
    <% @question_type.question_fields.each do |question_field| %>
      <%= fields_for "question_fields[#{question_field.position}]", question_field do |ff| %>
        <tr><td>Name</td><td><%= ff.text_field :name %></td></tr>
        <tr><td>Min</td><td><%= ff.text_field :min_len %></td></tr>
        <tr><td>Max</td><td><%= ff.text_field :max_len %></td></tr>
      <% end %>
      <tr><td>-</td></tr>
    <% end %>
    </table>
    <%= f.submit %>
  </div>
<% end %>
